package com.ruoyi.web.service;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.mapper.FoodIngredientMapper;
import com.ruoyi.web.domain.FoodIngredient;


/**
 * 食材Service业务层处理
 *
 * @author xian_pei
 * @date 2024-06-13
 */
@Service
public class FoodIngredientService
{
    @Autowired
    private FoodIngredientMapper foodIngredientMapper;

    /**
     * 查询食材
     *
     * @param ingredientId 食材主键
     * @return 食材
     */

    public FoodIngredient selectFoodIngredientByIngredientId(Long ingredientId)
    {
        return foodIngredientMapper.selectFoodIngredientByIngredientId(ingredientId);
    }

    /**
     * 查询食材列表
     *
     * @param foodIngredient 食材
     * @return 食材
     */

    public List<FoodIngredient> selectFoodIngredientList(FoodIngredient foodIngredient)
    {
        return foodIngredientMapper.selectFoodIngredientList(foodIngredient);
    }

    /**
     * 新增食材
     *
     * @param foodIngredient 食材
     * @return 结果
     */

    public int insertFoodIngredient(FoodIngredient foodIngredient)
    {
        return foodIngredientMapper.insertFoodIngredient(foodIngredient);
    }

    /**
     * 修改食材
     *
     * @param foodIngredient 食材
     * @return 结果
     */

    public int updateFoodIngredient(FoodIngredient foodIngredient)
    {
        foodIngredient.setUpdateTime(DateUtils.getNowDate());
        return foodIngredientMapper.updateFoodIngredient(foodIngredient);
    }

    /**
     * 批量删除食材
     *
     * @param ingredientIds 需要删除的食材主键
     * @return 结果
     */

    public int deleteFoodIngredientByIngredientIds(Long[] ingredientIds)
    {
        return foodIngredientMapper.deleteFoodIngredientByIngredientIds(ingredientIds);
    }

    /**
     * 删除食材信息
     *
     * @param ingredientId 食材主键
     * @return 结果
     */

    public int deleteFoodIngredientByIngredientId(Long ingredientId)
    {
        return foodIngredientMapper.deleteFoodIngredientByIngredientId(ingredientId);
    }
}
